package touchtrack.model.track;

import java.awt.Image;

import touchtrack.model.artist.Artist;
import touchtrack.util.TrackPlayer;

/**
 * LocalTrack
 * 
 * Track class representing a track that's stored on the user's machine.
 * 
 * @author	MuMe09 team 6
 * 			http://mumetech.wordpress.com/
 */
public class LocalTrack extends Track
{
	/**
	 * Constructs a Track object.
	 * 
	 * @param	Artist artist
	 * @param 	String title
	 * @param	image
	 */
	public LocalTrack(Artist artist, String title, Image image, String mp3path)
	{
		super(artist, title, image);
		setMp3path(mp3path);
	}

	/**
	 * Sets path to the mp3 file as String.
	 * 
	 * @param 	String mp3path
	 * @effect	Sets the path to the mp3 file as String.
	 */
	private void setMp3path(String mp3path)
	{
		this.mp3path = mp3path;
	}

	/**
	 * @return	Path as String to mp3 file.
	 */
	public String getMp3path()
	{
		return mp3path;
	}
	
	/**
	 * Plays the MP3 file.
	 */
	public void play()
	{
		if ( mp3path != null && ! mp3path.equals("") )
			TrackPlayer.play(getMp3path());
	}

	private String mp3path;
}